package com.cl.short_video_java.web.client;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cl.short_video_java.common.Result;
import com.cl.short_video_java.pojo.VideoType;
import com.cl.short_video_java.service.VideoTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author 付
 * @Date 2024-12-03 9:32
 * @Version 1.0
 * @description
 * @since 1.0
 */
@RestController
@RequestMapping("/client/tag")
@Slf4j
public class ClientTagsController {

	private VideoTypeService typeService;

	public ClientTagsController(VideoTypeService typeService) {
		this.typeService = typeService;
	}

	@GetMapping("/list")
	public Result getList() {
		List<VideoType> list = typeService.list(new QueryWrapper<VideoType>().last("limit 50"));
		return Result.success(list);
	}

	@GetMapping("/all")
	public Result classify() {
		List<VideoType> list = typeService.list(new QueryWrapper<VideoType>().orderByDesc("sort").last("limit 100"));
		return Result.success(list);
	}
}
